import http from '../util/http'

// 接口API统一
export default class Api {
    // 微信登录后台
  static apiWeChatLogin(code,companyId) {
    return http.get('/account/login?code=' + code + '&companyId='+companyId)
  }
    // 微信登录后台
  static apiWeChatUserInfo(data) {
    return http.post('/account/bind', data)
  }
    // 获取首页数据
  static findIndexData() {
    return http.get('/page/index')
  }
    // 获取商品分类列表
  static findGoodsTypeList(parentId) {
    return http.get('/goods/typeList/'+parentId)
  }
    // 获取二级
  static findTypeListByParentId(id) {
    return http.get('/goods/findTypeListByParentId/'+id)
  }
    // 获取商品列表
  static findGoodsList(param) {
    return http.get('/goods/list', param)
  }
    // 获取商品列表
  static findSku(goodsId) {
    return http.get('/goods/sku', {goodsId})
  }
  // 获取商品详情
  static findGoodsDetail(barCode) {
    return http.get('/goods/detail/'+barCode)
  }
  //获取新品
  static apiFindNewGoodsList(id){
    return http.get('/goods/findNewGoodsList/'+id)
  }
  // 提交订单
  static apiSubmitOrder(data) {
    return http.post('/order/createOrder', data)
  }
  // 支付
  static apiOrderToPay(data) {
    return http.post('/order/orderToPay', data)
  }
  // 获取订单列表
  static apiFindOrderList(param) {
    return http.get('/order/', param)
  }
  // 获取订单详情
  static apiFindOrderDetail(orderNo) {
    return http.get('/order/findDetail?orderNo=' + orderNo)
  }
  //取消订单
  static apiCancelOrder(id){
    return http.put('/order/cancelOrder/'+id)
  }
  // 添加到购物车
  static addToShopCart(data) {
    return http.post('/shopcart', data)
  }
  // 获取购物车列表
  static findShopCart() {
    return http.get('/shopcart')
  }
  // 更新购物车商品数量
  static changeNum(param) {
    return http.put('/shopcart/changeNum', param)
  }
  // 删除购物车商品
  static apiDeletedShopCar(id) {
    return http.delete('/shopcart/'+id)
  }
  // 获取个人信息
  static apiFindMemberDetail() {
    return http.get('/member/findDetail')
  }
  // 会员注册
  static apiMemberRechargeToPay(data) {
    return http.post('/member/rechargeToPay', data)
  }
  // 保存个人信息  新增
  static apiSaveMember(data) {
    return http.post('/member', data)
  }
  // 发送验证码
  static apiSendVerifyCode(phone) {
    return http.get('/member/sendVerifyCode?phone=' + phone)
  }
  // 绑定会员
  static apiBindMember(data) {
    return http.post('/members/login', data)
  }
  //获取用的优惠券列表
  static apiFindUserCouponList(status){
    return http.get('/member/findUserCouponList',{status:status})
  }
  //获取用的优惠券详情
  static apiFindUserCouponDetail(id){
    return http.get('/member/findUserCouponDetail/'+id)
  }
  //查询优惠券
  static apiFindUserCoupon(data){
    return http.post('/member/findUserCoupon',data)
  }
  // 修改会员手机号
  static apiBindPhone(data) {
    return http.put('/member/bindPhone', data)
  }
  // 获取会员权益说明
  static apiFindMemberPower() {
    return http.get('/member/findMemberPower')
  }
  // 会员续费创建订单
  static apiSaveMemberRecharge() {
    return http.post('/member/saveMemberRecharge')
  }
  // 获取收货地址列表
  static apiFindReceiveAddressList() {
    return http.get('/address/')
  }
  // 获取收货地址详情
  static apiFindReceiveAddress(id) {
    return http.get('/address/' + id)
  }
  // 保存收货地址详情
  static apiSaveReceiveAddress(data) {
    if(data.id !=null){
      return http.put('/address/'+data.id, data)
    }else{
      return http.post('/address', data)
    }
  }
  // 获取默认收货地址
  static apiFindDefaultAddress() {
    return http.get('/address/findDefaultAddress')
  }
  // 获取城市列表
  static apiFindCityList() {
    return http.get('/address/findCityList')
  }
  // 删除收货地址
  static apiDeletedAddress(id) {
    return http.delete('/address/'+id)
  }

  //查询新手礼包
  static apiFindNewUserCoupon(){
    return http.get('/coupon/findNewUserCoupon')
  }
  //获得活动详情
  static apiFindActivity(code){
    return http.get('/activity/findByCode',{code:code})
  }
  //获取分类页的公告
  static apiFindNoticeByCategory(categoryId){
    return http.post('/activity/findNoticeByCategory/'+categoryId)
  }
  //获取我的  页面
  static apiFindUserIndex(){
    return http.get('/user/index')
  }
  //获取我的  页面
  static apiSaveUser(data){
    return http.put('/user',data)
  }
  //我的收藏页面
  static apiFindFavoriteGoodsList(){
    return http.get('/userFavoriteGoods/')
  }
  //删除我的收藏
  static apiDeleteFavoriteGoods(id){
    return http.delete('/userFavoriteGoods/'+id)
  }

  //签到
  static apiSaveSign(){
    return http.post('/sign/')
  }
  //签到index
  static apiFindSignIndex(){
    return http.get('/sign/')
  }
  //补签
  static apiSaveSignFill(id){
    return http.post('/sign/saveSignFill/'+id)
  }
  //签到兑换优惠券
  static apiSaveExchangeCoupon(data){
    return http.post('/sign/saveCoupon',data)
  }
  //收藏商品
  static apiSaveFavoriteGoods(data){
    return http.post('/userFavoriteGoods/',data)
  }
  //骑手查询订单
  static apiFindStaffOrderList(param){
    return http.get('/staffOrder/',param)
  }
  //骑手查询订单详情
  static apiFindStaffOrder(id){
    return http.get('/staffOrder/'+id)
  }
  //骑手核销订单
  static apiVerifyStaffOrder(id){
    return http.put('/staffOrder/verifyStaffOrder/'+id)
  }
  //绑定骑手
  static apiBindStaff(staffId){
    return http.put('/staff/bindStaff/'+staffId)
  }
  //获取商品列表页广告列表
  static apiFindTypeAdvertisingList(){
    return http.get('/advertising/findTypeList')
  }
  //获取所有的分站
  static apiFindSiteList(){
    return http.get('/site/')
  }
  //获取分站下所有的区域
  static apiFindSiteRegionList(siteId){
    return http.get('/site/findRegionList/'+siteId)
  }
}

